<!-- 首页 -->
<template>
  <div>
    <iframe :src="url" style="width: 100%; height: calc(100vh - 10vh)"></iframe>
  </div>
</template>

<script setup name="home">
  import { onMounted, ref } from "vue";

  let url = ref('')
  let myHeaders = new Headers();
  myHeaders.append("Content-Type", "application/json");
  myHeaders.append("Accept", "*/*");
  myHeaders.append("Host", "10.6.100.106:8200");
  myHeaders.append("Connection", "keep-alive");

  let raw = `{"userName":"wt3175","password":"sywYALdFM@yf"}`;

  // 页面加载时
  onMounted(async () => {

    let requestOptions = {
      method: 'POST',
      headers: myHeaders,
      body: raw,
      redirect: 'follow'
    };

    let res = await fetch("/forguncy/equipmentplatform/SSO/GetUserToken", requestOptions)
    let str = await res.text()
    url.value = `https://10.6.100.106:8200/equipmentplatform?token=${str}`
  });
</script>

<style scoped lang="scss">
  iframe {
    border: none;
    background-color: white;
  }
</style>